package com.tao.mytestsocket.http

import com.tao.mytestsocket.BroadCastManager

/**
 *reate by tao on{DATE}
 */
object MsgCache {
   private val cacheMap = mutableMapOf<Int,String>()
    
    fun putMsg(msg:String){
        cacheMap[msg.hashCode()] =msg
        BroadCastManager.sendMsgBroadcast(msg.hashCode())
    }
    fun tackMsg(hash:Int) : String? {
        if (cacheMap.containsKey(hash)){
            try {
                return cacheMap[hash]
            } finally {
                cacheMap.remove(hash)
            }
        }
        return null
    }
    
    
}